package com.bowen.demo.demo005;

/**
 * <h3>java-study</h3>
 * <p>Student </p>
 * @author : zhang.bw
 * @date : 2021-03-21 00:24
 **/
public class Student {

	public String name;
	protected int age;
	char sex;
	private String phoneNum;

	@Override
	public String toString() {
		return "Student [name=" + name + ", age=" + age + ", sex=" + sex
				+ ", phoneNum=" + phoneNum + "]";
	}


	//--------------------------------------------
	public Student(){
		System.out.println("调用了公有、无参构造方法。。。");
	}

	public Student(char name){
		System.out.println("姓名：" + name);
	}

	public Student(String name ,int age){
		System.out.println("姓名："+name+"年龄："+ age);
	}

	//受保护的构造方法
	protected Student(boolean b){
		System.out.println("受保护的构造方法 b = " + b);
	}

	//私有构造方法
	private Student(int age){
		System.out.println("私有的构造方法，年龄："+ age);
	}

	//--------------------------------------------
	public void show1(String s){
		System.out.println("调用了：公有的，String参数的show1(): s = " + s);
	}
	protected void show2(){
		System.out.println("调用了：受保护的，无参的show2()");
	}
	void show3(){
		System.out.println("调用了：默认的，无参的show3()");
	}
	private String show4(int age){
		System.out.println("调用了，私有的，并且有返回值的，int参数的show4(): age = " + age);
		return "abcd";
	}
}
